var ec_left1 = echarts.init(document.getElementById("l1"), "dark")

$.get('http://localhost:8080/player/list', function (res) {
    var names = []
    var nums = []
    for (var i = 0; i < res.length; i++) {
        names.push(res[i].player);
        nums.push(res[i].session);
    }
    ec_left1.setOption({
        textStyle: {
            color: 'white'
        },
        title: {
            text: 'NBA球员出场次数',
            left: "auto"
        },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['出场数']

        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        toolbox: {
            feature: {
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            data: names
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '出场数',
                type: 'line',
                stack: '总量',
                data: nums
            }
        ]
    })
})
